*************************REPLICATION FILE************************************************

* Title: Undermining U.S. reputation: Chinese vaccines and aid and the alternative 
* provision of public goods during COVID-19
* Author: Francisco Urdinez 
* Journal: Review of International Organizations

*****************************************************************************************

*1. UPLOAD DATA 
clear all
import delimited "dataset.csv"

*2. INSTALL PACKAGES
ssc install estout
ssc install cem 
ssc install coefplot 
ssc install blindschemes
set scheme plotplain

*3. DECLARE AS PANEL DATA 
xtset respondent_code wave

*4. CREATE VARIABLES

**4.1. reputational gap
gen reput_gap=(usa_score - china_score)
sum reput_gap

**4.2. preference for China
gen prefer_china=1 if china_score >usa_score
replace prefer_china=0 if china_score <=usa_score
gen delta_prefer=d.prefer_china
gen preference=1 if delta_prefer==1
replace preference=0 if delta_prefer!=1

**4.3. Target population
gen target_population=1 if country==1 & age>=58
replace target_population =1 if country==2 & age>=60 & age<=88
replace target_population =1 if country==3 & age>=60 & age<=88
replace target_population =1 if country==4 & age>=52
replace target_population =1 if country==5 & age>=61
replace target_population =1 if country==6 & age>=69
replace target_population =0 if target_population ==.

**4.4. City received donations
gen exposed_donations= 5318659 if region_ar==2 
replace exposed_donations= 21808 if region_ar==3
replace exposed_donations= 18500 if region_ar==4
replace exposed_donations= 144000 if region_ar==5
replace exposed_donations= 120000 if region_ar==8
replace exposed_donations= 560 if region_ar==19
replace exposed_donations= 3650 if region_ar==23
replace exposed_donations= 368101 if region_br==2818
replace exposed_donations= 872490 if region_br==2822
replace exposed_donations= 1200000 if region_br==2824
replace exposed_donations= 20000 if region_br==2825
replace exposed_donations= 920000 if region_br==2826
replace exposed_donations= 4000 if region_br==2830
replace exposed_donations= 63200 if region_br==2831
replace exposed_donations= 176600 if region_br==2833
replace exposed_donations= 5715500 if region_br==2834
replace exposed_donations= 8000 if region_br==2838
replace exposed_donations= 14000 if region_br==2839
replace exposed_donations= 4000 if region_br==2840
replace exposed_donations= 14000000 if region_br==2841
replace exposed_donations= 12000 if region_cl==2
replace exposed_donations= 70800 if region_cl==4
replace exposed_donations= 24000 if region_cl==6
replace exposed_donations= 9989700 if region_cl==13
replace exposed_donations= 2140 if region_cl==15
replace exposed_donations= 20632 if region_mx==21
replace exposed_donations= 4500  if region_mx==27
replace exposed_donations= 4087410 if region_mx==28
replace exposed_donations= 4500 if region_mx==29
replace exposed_donations= 3000  if region_mx==30
replace exposed_donations= 60600  if region_mx==32
replace exposed_donations= 62500 if region_mx==33
replace exposed_donations= 4500  if region_mx==37
replace exposed_donations= 4500  if region_mx==38
replace exposed_donations= 19500 if region_mx==41
replace exposed_donations= 4500  if region_mx==42
replace exposed_donations= 4000  if region_mx==48
replace exposed_donations= 4500 if region_mx==49
replace exposed_donations= 4000  if region_mx==50
replace exposed_donations= 4000 if region_mx==51
replace exposed_donations= 2675600  if region_co==1
replace exposed_donations= 158500  if region_co==2
replace exposed_donations= 21000  if region_co==3
replace exposed_donations=  29310 if region_co==4
replace exposed_donations= 9000  if region_co==6
replace exposed_donations= 16710  if region_co==7
replace exposed_donations= 9000 if region_co==8
replace exposed_donations= 8400 if region_co==9
replace exposed_donations= 21900 if region_co==10
replace exposed_donations= 16500 if region_co==14
replace exposed_donations= 7500 if region_co==15
replace exposed_donations= 15000 if region_co==17
replace exposed_donations= 8000 if region_pe==2
replace exposed_donations= 240000 if region_pe==10
replace exposed_donations= 6607046 if region_pe==15
replace exposed_donations= 200  if region_pe==16
replace exposed_donations= 40000  if region_pe==24
replace exposed_donations=0 if exposed_donations==.
replace exposed_donations=exposed_donations/1000000
gen exposed_donations_dummy =1 if exposed_donations>0
replace exposed_donations_dummy=0 if exposed_donations_dummy==.

**4.5. Yearly variation of reputation gap 
xtset respondent_code wave
gen delta_reput_gap=d.reput_gap

**4.6. reputation towards third countries
gen gap_japan= (china_score-japan_score)
gen gap_korea= (china_score-south_korea_score )
gen placebo_score=  (japan_score + south_korea_score)/2
gen reput_gap_placebo = (china_score-placebo_score)
gen preference_placebo=1 if placebo_score>china_score
replace preference_placebo=0 if placebo_score<=china_score
gen delta_repu_gap_placebo = d.reput_gap_placebo

*5. FIGURES AND TABLES

**5.1. Table 2: Cases in Each Group of Respondents
tab2  vaccine news_experiment  if wave==2021

**5.2. Figure 2: Histograms of favorability scores assigned to China and U.S
sum china_score if wave==2020
sum china_score if wave==2021

hist china_score  if wave==2020, bin(10) xline( 47.35) percent
hist china_score  if wave==2021, bin(10) xline( 50.08) percent

sum usa_score if wave==2020
sum usa_score if wave==2021

hist usa_score if wave==2020, bin(10) xline( 55.72) percent
hist usa_score if wave==2021, bin(10) xline( 62.27) percent

sum delta_china
sum delta_usa

hist delta_china , bin(10) percent
hist delta_usa , bin(10) percent

**5.3. Figure 3: Histograms of favorability scores assigned to China relative to the U.S.
sum reput_gap if wave ==2020
hist reput_gap if wave ==2020, bin(10) xline(8.37) percent

sum reput_gap if wave ==2021
hist reput_gap if wave ==2021, bin(10) xline(12.18) percent

hist delta_reput_gap, bin(10) percent

**5.4. Figure 4: Histograms of preference for China relative to the U.S.
hist prefer_china if wave ==2020, percent discrete
hist prefer_china if wave ==2021, percent discrete
hist delta_prefer, percent discrete

**5.5. Table 3: Effect of Chinese Vaccines on China’s Reputation
xtreg china_score vaccine i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m1

xtreg usa_score  vaccine i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m2

xtreg reput_gap vaccine i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m3

xtreg preference  vaccine i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m4

esttab m1 m2 m3 m4 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**5.6. Table 4: Effect of Survey Experiment on China’s Reputation
xtreg china_score news_experiment  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m1

xtreg usa_score  news_experiment  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m2

xtreg reput_gap news_experiment  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m3

xtreg preference  news_experiment  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m4

esttab m1 m2 m3 m4 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**5.7. Table 5: Effect of Chinese Vaccines and Survey Experiment on China’s Reputation
xtreg china_score  vaccine##news_experiment  i.wave if both_waves!=0 &  duration >150, fe vce(cluster respondent_code)
estimates store m1

xtreg usa_score  vaccine##news_experiment  i.wave if both_waves!=0  & duration >150, fe vce(cluster respondent_code)
estimates store m2

xtreg reput_gap  vaccine##news_experiment  i.wave if both_waves!=0  & duration >150, fe vce(cluster respondent_code)
estimates store m3

xtreg preference   vaccine##news_experiment  i.wave if both_waves!=0  & duration >150, fe vce(cluster respondent_code)
estimates store m4

esttab m1 m2 m3 m4 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**5.8. Table 6: Effect of Chinese Vaccines Exclusively on the Vaccinated Population
xtreg china_score vaccine i.wave if target_population==1 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m5

xtreg usa_score  vaccine i.wave##i.target_population if target_population==1 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m6

xtreg reput_gap vaccine i.wave##i.target_population if target_population==1  & both_waves!=0, fe vce(cluster respondent_code)
estimates store m7

xtreg preference  vaccine i.wave##i.target_population if target_population==1  & both_waves!=0, fe vce(cluster respondent_code)
estimates store m8

esttab m5 m6 m7 m8 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**5.9. Table 7: cases in Each Group of Respondent
tab2  news_experiment  exposed_donations_dummy if wave==2021

**5.10. Table 8: Effect of Survey Experiment on Individuals Exposed to Chinese Aid
xtreg china_score news_experiment##exposed_donations_dummy  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m5
xtreg usa_score  news_experiment##exposed_donations_dummy  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m6
xtreg reput_gap news_experiment##exposed_donations_dummy  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m7
xtreg preference  news_experiment##exposed_donations_dummy  i.wave if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m8
esttab m5 m6 m7 m8 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**5.11. Figure 6: Histogram of Average Favorability Scores Assigned to  third countries
sum reput_gap_placebo  if wave==2020
sum reput_gap_placebo  if wave==2021
hist reput_gap_placebo  if wave==2020, bin(10) percent xline(-12.08)
hist reput_gap_placebo  if wave==2021, bin(10) percent xline(-10.12)
hist delta_repu_gap_placebo , bin(10) percent

**5.12. Table 9: Effects of Reputational Changes on Third Countries
xtreg placebo_score  vaccine news_experiment i.wave if both_waves!=0, fe vce(cluster respondent_code)
estimates store t8a
xtreg reput_gap_placebo vaccine news_experiment i.wave if both_waves!=0, fe vce(cluster respondent_code)
estimates store t8b
xtreg preference_placebo vaccine news_experiment i.wave  if both_waves!=0, fe vce(cluster respondent_code)
estimates store t8c
esttab t8a t8b t8c, se r2 star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

*6. ONLINE APPENDIX

**6.1. Table A. Descriptive statistics 
sum   age sex ideology education income  if wave==2020 & both_waves ==0 

sum   age sex ideology education income  if wave==2020 & both_waves ==1

sum   age sex ideology education income  if wave==2021 & both_waves ==1

**6.2. Figure A. Mean difference of output variables in surveyed individuals in one wave and in two waves
tabstat china_score  if wave==2020, by(both_waves ) st(mean median)
ttest china_score  if wave==2020, by(both_waves )
graph box china_score  if wave==2020, by(both_waves )

tabstat usa_score  if wave==2020, by(both_waves ) st(mean median)
ttest usa_score  if wave==2020, by(both_waves )
graph box  usa_score   if wave==2020, by(both_waves )

tabstat reput_gap  if wave==2020, by(both_waves ) st(mean median)
ttest reput_gap  if wave==2020, by(both_waves )
graph box  reput_gap if wave==2020, by(both_waves )

**6.3. Table B. Percentage of people answering affirmatively to the question about the  Chinese vaccine and the national percentage of those vaccinated
tabstat vaccine if wave==2021, by(country_name)

**6.4. Table D. Balancing Test
reg vaccine   ideology education sex agerecode income i.country if wave==2021  & duration >150, beta
estimates store m1 

reg vaccine   ideology education sex agerecode income i.country if wave==2021 & target_population ==1  & duration >150, beta
estimates store m2

reg news_experiment    ideology education sex agerecode income i.country if wave==2021  & duration >150, beta
estimates store m3 

reg exposed_donations_dummy    ideology education sex agerecode income i.country if wave==2021  & duration >150, beta
estimates store m4 

esttab m1 m2 m3 m4, r2 se 

**6.5. Table E. Test of Cross-Contamination of Treatments
reg   vaccine news_experiment exposed_donations_dummy if both_waves!=0, beta
estimates store m1 

esttab  m1, r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**6.6. Table F. Difference-in-differences after Coarsened Exact Matching 
cem ideology sex agerecode education  region_code , treatment(vaccine) showbreaks

xtreg china_score  vaccine i.wave if cem_matched ==1 & duration >150, fe vce(cluster respondent_code)
estimates store t2a

xtreg usa_score  vaccine i.wave if cem_matched ==1 & duration >150, fe vce(cluster respondent_code)
estimates store t2b

xtreg reput_gap vaccine i.wave if cem_matched ==1 & duration >150 , fe vce(cluster respondent_code)
estimates store t2c

xtreg preference vaccine i.wave if cem_matched ==1 & duration >150, fe vce(cluster respondent_code)
estimates store t2d

esttab  t2a t2b  t2c t2d, se r2 star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**6.7. Table G. Difference-in-differences Controlling for Education of Respondent
xtreg china_score  vaccine  c.education##i.wave if both_waves!=0  & duration >150, fe vce(cluster respondent_code)
estimates store m1

xtreg usa_score  vaccine c.education##i.wave if both_waves!=0   & duration >150, fe vce(cluster respondent_code)
estimates store m2

xtreg reput_gap  vaccine c.education##i.wave if both_waves!=0   & duration >150, fe vce(cluster respondent_code)
estimates store m3

xtreg preference vaccine c.education##i.wave if both_waves!=0  & duration >150, fe vce(cluster respondent_code)
estimates store m4

esttab m1 m2 m3 m4 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**6.8. Table H. Effect of Vaccination Controlling for Vaccinated People
xtreg china_score vaccine i.wave##target_population if  duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m5

xtreg usa_score  vaccine i.wave##target_population if  duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m6

xtreg reput_gap vaccine i.wave##target_population if  duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m7

xtreg preference vaccine i.wave##target_population if  duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m8

esttab m5 m6 m7 m8 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

**6.9. Table I. Effect of Vaccination and Survey Experiment Combined 
xtreg china_score news_experiment##exposed_donations_dummy  vaccine i.wave##i.target_population if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m5

xtreg usa_score  news_experiment##exposed_donations_dummy  vaccine i.wave##i.target_population if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m6

xtreg reput_gap news_experiment##exposed_donations_dummy  vaccine i.wave##i.target_population if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m7

xtreg preference news_experiment##exposed_donations_dummy  vaccine i.wave##i.target_population if duration >150 & both_waves!=0, fe vce(cluster respondent_code)
estimates store m8

esttab m5 m6 m7 m8 , r2 se star(+ 0.10 * 0.05 ** 0.01 *** 0.001)

